//
//  UIButton+extention.m
//  Charge
//
//  Created by lxj on 2017/9/22.
//  Copyright © 2017年 lxj. All rights reserved.
//

#import "UIButton+extension.h"

@implementation UIButton (extension)


-(instancetype)initWithFrame:(CGRect)frame text:(NSString *)text textcolor:(UIColor *)textcolor backgroundcolor:(UIColor *)backgroundcolor fontSize:(CGFloat)fontSize haveCorner:(BOOL)haveCorner{
    if (self = [self initWithFrame:frame]) {
        [self setTitle:text forState:UIControlStateNormal];
        [self setTitleColor:textcolor forState:UIControlStateNormal];
        self.backgroundColor = backgroundcolor;
        self.titleLabel.font = SBFONT(fontSize);
        if (haveCorner) {
            self.layer.cornerRadius = 5;
            self.layer.masksToBounds = YES;
        }
    }
    return self;
}


-(instancetype)initWithFrame:(CGRect)frame text:(NSString *)text textcolor:(UIColor *)textcolor backgroundcolor:(UIColor *)backgroundcolor fontSize:(CGFloat)fontSize haveCorner:(BOOL)haveCorner image:(NSString *)image selectImage:(NSString *)selectImage{
    if (self = [self initWithFrame:frame text:text textcolor:textcolor backgroundcolor:backgroundcolor fontSize:fontSize haveCorner:haveCorner]) {
        [self setImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
        [self setImage:[UIImage imageNamed:selectImage] forState:UIControlStateSelected];
    }
    return self;
}
- (void)setHighlighted:(BOOL)highlighted {
    
}
@end
